export const requestData = (options) => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: options.url,
            method: options.method || 'GET',
            data: options.data || {},
            header: {
                cookie: wx.getStorageSync('cookies') ? wx.getStorageSync('cookies').find(item => item.indexOf('MUSIC_U') !== -1) : ''
            },
            success (res) {
                resolve(res.data)
                if (options.data.isLogin) {
                    wx.setStorageSync('cookies', res.cookies)
                }
            },
            fail (err) {
                wx.showToast({
                  title: '获取数据失败',
                  icon: 'none'
                })
                reject(err)
            }
        })
    })
}